import BackLogin from "../views/login/BackLogin";
import BackIndex from "../views/backstage/BackIndex";
import WelComePage from "../views/backstage/welcomepage/WelComePage";
import ViewInfo from "../views/backstage/personalSetting/ViewInfo";
import EditPassword from "../views/backstage/personalSetting/EditPassword";
import EditInfo from "../views/backstage/personalSetting/EditInfo";
import UserList from "../views/backstage/UserManage/UserList";
import EnterpriseList from "../views/backstage/enterpriseManage/EnterpriseList";
import RecruitmentInfoList from "../views/backstage/recruitmentInfoManage/RecruitmentInfoList";
import JobInfoList from "../views/backstage/jobInfoManage/JobInfoList";
import {getStore} from "../storage/storage";
import ViewEnterpriseInfo from "../views/backstage/enterpriseManage/ViewEnterpriseInfo";
import FirstPage from "../views/reception/menu/FirstPage";
import ReceptionLoginPage from "../views/reception/ReceptionLoginPage";
import ReceptionRegister from "../views/reception/ReceptionRegister";
import RecuritInfoPage from "../views/reception/menu/RecuritInfoPage";
import JobInfoPage from "../views/reception/menu/JobInfoPage";
import PersonalPage from "../views/reception/menu/PersonalPage";
import MyInfo from "../views/reception/menu/MyInfo";
import MyCollection from "../views/reception/menu/MyCollection";
import DataViewPage from "../views/backstage/dataViewManage/DataViewPage";
import CompanyRecruitInfos from "../views/reception/firstpagePages/CompanyRecruitInfos";
import EditCompanyInfo from "../views/backstage/enterpriseManage/EditCompanyInfo";
import RecuritDetail from "../views/reception/firstpagePages/RecuritDetail";
import UserAndJobPage from "../views/reception/firstpagePages/UserAndJobPage";
import MyResumePage from "../views/reception/MyResumePage";
import EditMyResume from "../views/reception/EditMyResume";
import MyDeliverRecord from "../views/reception/MyDeliverRecord";
import MyMessagePage from "../views/reception/MyMessagePage";

// 静态路由
export const staticRouter = [
    {
        path: "/",
        name: "Index",
        show: false,
        redirect:{name: 'IndexPage'}
    },
    {
        path: "/reception/index",
        name: 'IndexPage',
        show: false,
        redirect:{name: 'FirstPage'}
    },
    {
        path: "/reception/login",
        name: 'ReceptionLoginPage',
        show: false,
        component: ReceptionLoginPage
    },
    {
        path: "/backstage/login",
        name: 'BackLogin',
        show: false,
        component: BackLogin
    },
    {
        path: "/reception/firstPage",
        name: 'FirstPage',
        show: false,
        component: FirstPage
    },
    {
        path: "/reception/companyAllRecruitmentInfo",
        name: 'CompanyRecruitInfos',
        show: false,
        component: CompanyRecruitInfos
    },
    {
        path: "/reception/userPage",
        name: 'UserAndJobPage',
        show: false,
        component: UserAndJobPage
    },
    {
        path: "/reception/ReceptionRegister",
        name: 'ReceptionRegister',
        show: false,
        component: ReceptionRegister
    },
    {
        path: "/reception/recuritInfoPage",
        name: 'RecuritInfoPage',
        show: false,
        component: RecuritInfoPage
    },
    {
        path: "/reception/myResumePage",
        name: 'MyResumePage',
        show: false,
        component: MyResumePage,
    },
    {
        path: "/reception/editMyResume",
        name: 'EditMyResume',
        show: false,
        component: EditMyResume,
    },
    {
        path: "/reception/myMessagePage",
        name: 'MyMessagePage',
        show: false,
        component: MyMessagePage,
    },
    {
        path: "/reception/myDeliverRecord",
        name: 'MyDeliverRecord',
        show: false,
        component: MyDeliverRecord,
    },
    {
        path: "/reception/recruitInfoDetail",
        name: 'RecuritDetail',
        show: false,
        component: RecuritDetail
    },
    {
        path: "/reception/jobInfoPage",
        name: 'JobInfoPage',
        show: false,
        component: JobInfoPage
    },
    {
        path: "/reception/personalPage",
        name: 'PersonalPage',
        show: false,
        component: PersonalPage,
        redirect: '/reception/personalPage/myInfo',
        children:[
            {
                path: "/reception/personalPage/myInfo",
                name: 'myInfo',
                component: MyInfo,
            },
            {
                path: "/reception/personalPage/myCollection",
                name: 'myCollection',
                component: MyCollection,
            }
        ]
    },
    // {
    //     path: "/reception/companyInfo",
    //     name: 'MessageFeedbackPage',
    //     show: false,
    //     component: MessageFeedbackPage
    // },
]

// 动态路由(管理员的菜单)
const dynaicRouter_admin = [
    {
        path: '/backstage/index',
        name: '主页',
        iconCls: 'el-icon-platform-eleme',
        component: BackIndex,
        show: true,
        redirect: '/backstage/welcome',
        children: [
            {
                path: '/backstage/welcome',
                name: '欢迎页',
                iconCls: 'el-icon-orange',
                show: true,
                component: WelComePage,
            },
            {
                path: '/backstage/dataView',
                name: '数据展示',
                iconCls: 'el-icon-data-board',
                show: true,
                component: DataViewPage,
            },
        ]
    },
    {
        path: "/backstage/personal",
        name: '个人中心',
        component: BackIndex,
        iconCls: 'el-icon-user-solid',
        show: true,
        redirect: '/backstage/personal/viewInfo',
        children: [
            {
                path: '/backstage/personal/viewInfo',
                name: '个人信息',
                iconCls: 'el-icon-info',
                show: true,
                component: ViewInfo,
            },
            {
                path: '/backstage/personal/editPassword',
                name: '修改密码',
                iconCls: 'el-icon-edit',
                show: true,
                component: EditPassword,
            },
            {
                path: '/backstage/personal/editInfo',
                name: '修改个人信息',
                iconCls: 'el-icon-edit-outline',
                show: true,
                component: EditInfo,
            },
        ]
    },
    {
        path: "/backstage/userManage",
        name: '用户管理',
        component: BackIndex,
        show: true,
        iconCls: 'el-icon-user',
        redirect: '/backstage/userManage/userList',
        children: [
            {
                path: '/backstage/userManage/userList',
                name: '用户',
                iconCls: 'el-icon-user-solid',
                show: true,
                component: UserList,
            },
        ]
    },
    {
        path: "/backstage/enterprise",
        name: '企业管理',
        component: BackIndex,
        show: true,
        iconCls: 'el-icon-receiving',
        redirect: '/backstage/enterprise/enterpriseList',
        children: [
            {
                path: '/backstage/enterprise/enterpriseList',
                name: '企业列表',
                iconCls: 'el-icon-sunset',
                show: true,
                component: EnterpriseList,
            },
        ]
    },
    {
        path: "/backstage/recruitmentInfo",
        name: '招聘信息管理',
        component: BackIndex,
        show: true,
        iconCls: 'el-icon-notebook-2',
        redirect: '/backstage/recruitmentInfo/recruitmentInfoList',
        children: [
            {
                path: '/backstage/recruitmentInfo/recruitmentInfoList',
                name: '招聘信息',
                iconCls: 'el-icon-bell',
                show: true,
                component: RecruitmentInfoList,
            },
        ]
    },
    {
        path: "/backstage/jobInfo",
        name: '求职信息管理',
        component: BackIndex,
        show: true,
        iconCls: 'el-icon-collection',
        redirect: '/backstage/jobInfo/jobInfoList',
        children: [
            {
                path: '/backstage/jobInfo/jobInfoList',
                name: '求职信息',
                iconCls: 'el-icon-tickets',
                show: true,
                component: JobInfoList,
            },
        ]
    },
]

// 动态路由(用户的菜单)
const dynaicRouter_user = [
    {
        path: '/backstage/index',
        name: '主页',
        iconCls: 'el-icon-platform-eleme',
        component: BackIndex,
        show: true,
        redirect: '/backstage/welcome',
        children: [
            {
                path: '/backstage/welcome',
                name: '欢迎页',
                iconCls: 'el-icon-orange',
                show: true,
                component: WelComePage,
            },
            {
                path: '/backstage/dataView',
                name: '数据展示',
                iconCls: 'el-icon-data-board',
                show: true,
                component: DataViewPage,
            },
        ]
    },
    {
        path: "/backstage/personal",
        name: '个人中心',
        iconCls: 'el-icon-user-solid',
        show: true,
        component: BackIndex,
        redirect: '/backstage/personal/viewInfo',
        children: [
            {
                path: '/backstage/personal/viewInfo',
                name: '个人信息',
                iconCls: 'el-icon-info',
                show: true,
                component: ViewInfo,
            },
            {
                path: '/backstage/personal/editPassword',
                name: '修改密码',
                iconCls: 'el-icon-edit',
                show: true,
                component: EditPassword,
            },
            {
                path: '/backstage/personal/editInfo',
                name: '修改个人信息',
                iconCls: 'el-icon-edit-outline',
                show: true,
                component: EditInfo,
            },
        ]
    },
    {
        path: "/backstage/jobInfo",
        name: '求职信息管理',
        show: true,
        component: BackIndex,
        iconCls: 'el-icon-collection',
        redirect: '/backstage/jobInfo/jobInfoList',
        children: [
            {
                path: '/backstage/jobInfo/jobInfoList',
                name: '求职信息',
                iconCls: 'el-icon-tickets',
                show: true,
                component: JobInfoList,
            },
        ]
    },
]

// 动态路由(企业的菜单)
const dynaicRouter_enterprise = [
    {
        path: '/backstage/index',
        name: '主页',
        iconCls: 'el-icon-platform-eleme',
        component: BackIndex,
        show: true,
        redirect: '/backstage/welcome',
        children: [
            {
                path: '/backstage/welcome',
                name: '欢迎页',
                iconCls: 'el-icon-orange',
                show: true,
                component: WelComePage,
            },
            {
                path: '/backstage/dataView',
                name: '数据展示',
                iconCls: 'el-icon-data-board',
                show: true,
                component: DataViewPage,
            },
        ]
    },
    {
        path: "/backstage/personal",
        name: '企业中心',
        iconCls: 'el-icon-user-solid',
        show: true,
        component: BackIndex,
        redirect: '/backstage/personal/viewInfo',
        children: [
            {
                path: '/backstage/personal/viewInfo',
                name: '企业信息',
                iconCls: 'el-icon-info',
                show: true,
                component: ViewEnterpriseInfo,
            },
            {
                path: '/backstage/personal/editPassword',
                name: '修改密码',
                iconCls: 'el-icon-edit',
                show: true,
                component: EditPassword,
            },
            {
                path: '/backstage/personal/editCompanyInfo',
                name: '修改企业信息',
                iconCls: 'el-icon-edit-outline',
                show: true,
                component: EditCompanyInfo,
            },
        ]
    },
    {
        path: "/backstage/recruitmentInfo",
        name: '招聘信息管理',
        component: BackIndex,
        show: true,
        iconCls: 'el-icon-notebook-2',
        redirect: '/backstage/recruitmentInfo/recruitmentInfoList',
        children: [
            {
                path: '/backstage/recruitmentInfo/recruitmentInfoList',
                name: '招聘信息',
                iconCls: 'el-icon-bell',
                show: true,
                component: RecruitmentInfoList,
            },
        ]
    },
]



// 数据拼接（路由）
let roleAid = 1;
roleAid = Number(getStore("roleAid"));
if (roleAid === 1){
    // 拼接管理员的菜单
    dynaicRouter_admin.forEach(item=>{
        staticRouter.push({
            path: item.path,
            name: item.name,
            iconCls: item.iconCls,
            show: item.show,
            redirect: item.redirect,
            children: item.children ? item.children : [],
            component: item.component,
        })
    });
}else if (roleAid === 2){
    // 拼接用户的菜单
    dynaicRouter_user.forEach(item=>{
        staticRouter.push({
            path: item.path,
            name: item.name,
            iconCls: item.iconCls,
            show: item.show,
            redirect: item.redirect,
            children: item.children ? item.children : [],
            component: item.component,
        })
    });
}else if (roleAid === 3){
    // 拼接企业的菜单
    dynaicRouter_enterprise.forEach(item=>{
        staticRouter.push({
            path: item.path,
            name: item.name,
            iconCls: item.iconCls,
            show: item.show,
            redirect: item.redirect,
            children: item.children ? item.children : [],
            component: item.component,
        })
    });
}


